Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.Configuration
Imports System.Data
Imports System.Data.SqlClient

Public Partial Class TheatreStaff_Cinema
	Inherits System.Web.UI.Page
	Protected Sub Page_Load(sender As Object, e As EventArgs)
		srcCinema.SelectParameters("username").DefaultValue = Page.User.Identity.Name


		Dim connectionString As String
		connectionString = WebConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString

		Dim con As New SqlConnection(connectionString)
		Dim cmd As New SqlCommand("SELECT TheatreId from TheatreStaff WHERE TheatreStaffUsername=@username", con)

		cmd.Parameters.AddWithValue("@username", Page.User.Identity.Name)


		Using con
			con.Open()
			Dim TheatreID As Object = cmd.ExecuteScalar()

			If TheatreID IsNot Nothing Then

				lblId.Text = TheatreID.ToString()
			End If
		End Using


		Dim con1 As New SqlConnection(connectionString)
		Dim cmd1 As New SqlCommand("SELECT Theatrename from Theatre WHERE Theatreid=@theatreid", con1)

		cmd1.Parameters.AddWithValue("@theatreid", lblId.Text)


		Using con1
			con1.Open()
			Dim Theatrename As Object = cmd1.ExecuteScalar()

			If Theatrename IsNot Nothing Then

				Label4.Text = Theatrename.ToString()
			End If
		End Using


	End Sub
End Class
